package com.xuxin.nantai.presenter;

import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.bean.ProductInfoBean;
import com.xuxin.nantai.contract.HangUpdateContract;
import com.xuxin.nantai.model.HangUpdateModel;

/**
 * Created by xu_xin
 * Created on 2020.06.18 0018
 */
public class HangUpdatePresenter implements HangUpdateContract.Presenter {
    private HangUpdateModel model;
    private HangUpdateContract.View view;

    public HangUpdatePresenter(HangUpdateContract.View view) {
        model = new HangUpdateModel();
        this.view = view;
    }

    @Override
    public void getAllProductInfo(String InsType) {
        if (null != model) {
            model.getAllProductInfo(this, InsType);
        }
    }

    @Override
    public void update(String LoginName,
                       String UserName,
                       String Guid,
                       String ID,
                       String cInvName,
                       String PackQty,
                       String InspectorName,
                       String InspectorCode,
                       String InspectTime,
                       String FacArea,
                       String DefectNum,
                       String DefectDes,
                       String Remark) {
        if (null != model) {
            model.update(this,
                    LoginName,
                    UserName,
                    Guid,
                    ID,
                    cInvName,
                    PackQty,
                    InspectorName,
                    InspectorCode,
                    InspectTime,
                    FacArea,
                    DefectNum,
                    DefectDes,
                    Remark);
        }
    }

    @Override
    public void onSuccess(ProductInfoBean productInfoBean) {
        if (null != view) {
            view.onSuccess(productInfoBean);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}